<extend name="public/base"/>
<block name="style"></block>
<block name="body">
<div class="layui-card qn-header">
	<div class="layui-breadcrumb">
		<a href="">首页</a>
		<a href="">批量导入充值</a>
	</div>
</div>
<div class="layui-fluid">
	<div class="layui-card">
		<div class="layui-card-body">
		
		<form class="layui-form" action="{:U('pay/pay_import')}" id="form" method="post">
			<input name="filename" type="hidden" id="filename" value="" />
			<input name="exts" type="hidden" id="exts" value="" />
			<div class="form-body">
				<div class="layui-form-item">
					<label class="layui-form-label">选择导入模式</label>
					<div class="layui-input-block">
						<select class="" name="usertype">
							<option value="uid">用户ID</option>
							<option value="username">用户名</option>
						</select>
					</div>
					<div class="layui-form-mid layui-word-aux">选择导入模式，按照导入模式来生成表格，比如选用户ID模式，那第一列就要是用户ID，如果选择用户名模式，那第一列就是用户名</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">充值货币类型</label>
					<div class="layui-input-block">
						<select class="form-control" name="gold_type" >
						  <notempty name="scoreTypes">
							<volist name="scoreTypes" id="v">
							<option value="{$v.mark}">{$v.title}</option>
							</volist>
						  <else/>
							<option value="none">当前没有设置货币类型,请先设置</option>
						  </notempty>
						</select>
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">设置到</label>
					<div class="layui-input-block">
						<select class="" name="action_score" style="">
							<option value="inc">增加</option>
							<option value="dec">减少</option>
							<option value="to">设置到</option>
						</select>
					</div>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">表单格式</label>
					<div class="layui-input-block">
						<table class="layui-table" lay-even>
							<tbody>
							<tr class="">
							<td>1</td>
							<td>会员名（用户ID）</td>
							<td>充值货币金额（必须）</td>
							<td>备注</td>
							</tr>
							<tr class="alt-row">
							<td>2</td>
							<td>xxx1</td>
							<td>x</td>
							<td>xx</td>
							</tr>
							<tr class="">
							<td>3</td>
							<td>xxx2</td>
							<td>xxx</td>
							<td>xx</td>
							</tr>
							<tr class="alt-row">
							<td colspan="4">更多...</td>
							</tr>
							</tbody>
						</table>
					</div>
					<div class="layui-form-mid layui-word-aux">表单第一行是系统默认标题，请随便填写一些字符，不要在第一行写数据</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">上传表格</label>
					<div class="layui-input-block">
						<input type="button" id="upload_file_excelData" class="layui-box layui-upload-button" value="上传EXCEL" />
						<div class="upload-img-box">
							<present name="excelData">
								<div class="upload-pre-file"><span class="upload_icon_all"></span>{excelData|get_table_field=###,'id','name','File'}</div>
							</present>
						</div>
					</div>
					<script type="text/javascript">
					layui.use('upload', function(){
						var upload = layui.upload;
						upload.render({
							url: "{:U('Pay/upload',array('session_id'=>session_id()))}"
							,elem: '#upload_file_excelData' //指定原始元素，默认直接查找class="layui-upload-file"
							,accept: 'file'
							,field: 'excelData_id'
							,exts: 'xls|xlsx|csv'
							,method: 'post' //上传接口的http类型
							,before: function(input){
								//layer.msg('文件上传中', {icon: 16, fixed: true, offset: '80%', time:1000});
								layer.load(2, {shade: false});
							}
							,done: function(res, index, upload){
								layer.closeAll('loading'); //关闭loading
								if(res.status){
									$("input[name=filename]").val(res.url.excelData_id.rootPath + res.url.excelData_id.savepath + res.url.excelData_id.savename);
									$("input[name=exts]").val(res.url.excelData_id.ext);
									$('.upload-img-box').html(
										"<div class=\"upload-pre-file\"><span class=\"upload_icon_all\"></span>" + res.info + "</div>"
									);
								} else {
									layer.msg(res.info, {icon: 2, fixed: true, offset: '80%', time:1000});
									setTimeout(function(){
										$(that).removeClass('disabled').prop('disabled',false);
									},1500);
								}
							}
						});
					});
					</script>
					<div class="layui-form-mid layui-word-aux"></div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
					<div class="layui-footer">
					  <button class="layui-btn layui-btn-sm" lay-submit lay-filter="*">立即导入</button>
					  <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">重置</button>
					</div>
					</div>
				</div>

			</div>
		</form>
	</div>
</div>
</div>
</block>

<block name="script">
</block>